package huoye.shops.huoye.operation.adapter;

import android.content.Context;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.codeideology.android.widget.recycler.RecyclerViewAdapter;

import java.math.BigDecimal;

import butterknife.BindView;
import huoye.shops.R;
import huoye.shops.base.APIUrls;
import huoye.shops.huoye.operation.model.ManageEventData;
import huoye.shops.huoye.operation.model.StatisticsData;
import huoye.shops.utils.StockUtils;
import huoye.shops.widget.RoundImageView;


/**
 * Created by uesr on 2018/8/10.
 */

public class UserStatisticsAdapter extends RecyclerViewAdapter<UserStatisticsAdapter.ViewHolder,StatisticsData> {




    public UserStatisticsAdapter(Context context) {
        super(context, R.layout.item_user_statistics);
    }

    @Override
    protected ViewHolder initViewHolder(View view, int i) {
        return new ViewHolder(view);
    }

    @Override
    protected void bindView(ViewHolder holder, StatisticsData statisticsData, int i) {



        if(getContext() != null){
            Glide.with(getContext())
                    .load(statisticsData.getHeadImg())
                    .dontAnimate()
                    .placeholder(R.mipmap.ic_wait_logo)
                    .error(R.mipmap.ic_error)
                    .into(holder.rvHead);
        }
        holder.tvName.setText(statisticsData.getUserName());
        holder.tvVisitNumber.setText(statisticsData.getBrowseNum());
        holder.tvOrdersNumber.setText(statisticsData.getOrderNum());
        String money = StockUtils.moenyStyle(statisticsData.getTotalAmount());
        holder.tvOrdersMoney.setText(money+"");



    }


    public class ViewHolder extends RecyclerViewAdapter.ViewHolder {

        @BindView(R.id.item_user_statistics_tv_name)
        TextView tvName;
        @BindView(R.id.item_user_statistics_tv_visit_number)
        TextView tvVisitNumber;
        @BindView(R.id.item_user_statistics_tv_orders_number)
        TextView tvOrdersNumber;
        @BindView(R.id.item_user_statistics_tv_orders_money)
        TextView tvOrdersMoney;


        @BindView(R.id.item_user_statistics_rv_head)
        RoundImageView rvHead ;

  ;


        public ViewHolder(View itemView) {
            super(itemView);
        }
    }




}
